home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer: Getting Started / Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin / pc / mac / bonus / peter_le / finger_1 / tokens / timeon.p < prev   
Text File  |  1991-11-14  |  980b  |  46 lines

  1. unit TIMEON;
  2.  
  3. interface
  4.  
  5.     uses
  6.         ParameterDef;
  7.  
  8.     procedure Main (var p: parameterRecord);
  9.  
  10. implementation
  11.  
  12.     procedure Main (var p: parameterRecord);
  13.         procedure MyTimeString (secs: longInt; withsecs: boolean; var s: str255);
  14.             function mts (units, count: longInt; pair: boolean): str255;
  15.                 var
  16.                     t: longInt;
  17.                     s: str255;
  18.             begin
  19.                 t := secs div units mod count;
  20.                 NumToString(t, s);
  21.                 if pair then
  22.                     if length(s) < 2 then
  23.                         s := concat('0', s);
  24.                 mts := s;
  25.             end;
  26.         begin
  27.             s := concat(mts(3600, 24, false), ':', mts(60, 60, true));
  28.             if secs > 86400 then
  29.                 s := concat(mts(86400, 10000, false), 'd ', s);
  30.             if withsecs then
  31.                 s := concat(s, ':', mts(1, 60, true));
  32.         end;
  33.         var
  34.             t: longInt;
  35.     begin
  36.         t := TickCount div 60;
  37.         UprString(p.param^, false);
  38.         if p.param^ = 'TIMESEC' then
  39.             MyTimeString(t, true, p.returnValue^)
  40.         else if p.param^ = 'TIME' then
  41.             MyTimeString(t, false, p.returnValue^)
  42.         else
  43.             p.returnValue^ := '?';
  44.     end;
  45.  
  46. end.